/*
 ------------------------------------------------------------------------------
 Copyright (C) 2013 Eternal Games.

 This file is part of the EternalTech source code.

 The EternalTech source code is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or (at your
 option) any later version.

 The EternalTech source code is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 more details.

 You should have received a copy of the GNU General Public License along with
 the EternalTech source code; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 ------------------------------------------------------------------------------
*/


//
// protocol.h - data send across the network
//


#ifndef __PROTOCOL_H__
#define __PROTOCOL_H__


/*
 ==============================================================================

 Protocol:

 This is for basic communication between client and server in the engine.

 The game modules define their own protocol for communicating the initial game
 state, periodic state updates (snapshots), and other game related information.

 ==============================================================================
*/

#define PROTOCOL_VERSION			1

#define MAX_RELIABLE_COMMANDS		64			// Max string commands buffered for retransmit

// Server to client
enum svcOps_t {
	SVC_BAD,
	SVC_NOP,
	SVC_COMMAND,
	SVC_SERVERSTATE,
	SVC_GAMESTATE,
	SVC_SNAPSHOT,
	SVC_VOICE,
	SVC_DOWNLOAD,
	SVC_EOF
};

// Client to server
enum clcOps_t {
	CLC_BAD,
	CLC_NOP,
	CLC_COMMAND,
	CLC_MOVE,
	CLC_MOVENODELTA,
	CLC_VOICE,
	CLC_VOICEECHO,
	CLC_EOF
};

// Temporary entity event types
enum teTypes_t {
	TE_SPIKE,
	TE_SUPERSPIKE,
	TE_GUNSHOT,
	TE_EXPLOSION,
	TE_TAREXPLOSION,
	TE_LIGHTNING1,
	TE_LIGHTNING2,
	TE_WIZSPIKE,
	TE_KNIGHTSPIKE,
	TE_LIGHTNING3,
	TE_LAVASPLASH,
	TE_TELEPORT,
	TE_EXPLOSION2,
	TE_BEAM
};

// Stats are integers communicated to the client by the server
enum statTypes_t {
	STAT_HEALTH,
	STAT_FRAGS,
	STAT_WEAPON,
	STAT_AMMO,
	STAT_ARMOR,
	STAT_WEAPONFRAME,
	STAT_SHELLS,
	STAT_NAILS,
	STAT_ROCKETS,
	STAT_CELLS,
	STAT_ACTIVEWEAPON,
	STAT_TOTALSECRETS,
	STAT_TOTALMONSTERS,
	STAT_SECRETS,
	STAT_MONSTERS,
	STAT_ITEMS,

	MAX_STATS = 32
};

// Item flags are bits communicated to the client by the server
enum itemFlags_t {
	IT_SHOTGUN						= BIT(0),
	IT_SUPER_SHOTGUN				= BIT(1),
	IT_NAILGUN						= BIT(2),
	IT_SUPER_NAILGUN				= BIT(3),
	IT_GRENADE_LAUNCHER				= BIT(4),
	IT_ROCKET_LAUNCHER				= BIT(5),
	IT_LIGHTNING					= BIT(6),
	IT_SUPER_LIGHTNING				= BIT(7),
	IT_SHELLS						= BIT(8),
	IT_NAILS						= BIT(9),
	IT_ROCKETS						= BIT(10),
	IT_CELLS						= BIT(11),
	IT_AXE							= BIT(12),
	IT_ARMOR1						= BIT(13),
	IT_ARMOR2						= BIT(14),
	IT_ARMOR3						= BIT(15),
	IT_SUPERHEALTH					= BIT(16),
	IT_KEY1							= BIT(17),
	IT_KEY2							= BIT(18),
	IT_INVISIBILITY					= BIT(19),
	IT_INVULNERABILITY				= BIT(20),
	IT_SUIT							= BIT(21),
	IT_QUAD							= BIT(22),
	IT_SIGIL1						= BIT(23),
	IT_SIGIL2						= BIT(24),
	IT_SIGIL3						= BIT(25),
	IT_SIGIL4						= BIT(26)
};


#endif	// __PROTOCOL_H__